package com.cg.service;

import com.cg.entity.Event;
import com.cg.entity.EventCategoryName;
import com.cg.mapper.EventMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class EventService {
    @Autowired
    private EventMapper eventMapper;
    public List<EventCategoryName> selectList(String account){
        List<EventCategoryName> list=eventMapper.selectList(account);
        return list;
    }
    public int insert(Event event){
        int a=eventMapper.insertEvent(event);
        return a;
    }
    public Event selectone(int id){
        Event evevt=new Event();
        evevt=eventMapper.selectone(id);
        return evevt;
    }
    public int update(Event event){
        int a=eventMapper.update(event);
        return a;
    }
    public int delete(int id){
        int a=eventMapper.delete(id);
        return a;
    }
    public List<Event> selectA(int categoryId,String eventName){
        List<Event> list=eventMapper.selectA(categoryId,eventName);
        return list;
    }
    public List<Event>selectListByDateDesc(String username){
        List<Event>list=eventMapper.selectListByDateDesc(username);
        return list;
    }
    //模糊查询
    public List<EventCategoryName>selectLike(String createdBy,Integer categoryId,String title, Integer level, Integer status){
        List<EventCategoryName>list=eventMapper.selectLike(createdBy,categoryId,title,level,status);
        return list;
    }
}
